<!DOCTYPE html>
<html>

	<head lang="en">
		<meta charset="UTF-8">
		<title>登录</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="format-detection" content="telephone=no">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />

		<link rel="stylesheet" href="/mall/AmazeUI-2.4.2/assets/css/amazeui.css" />
		<link href="/mall/css/dlstyle.css" rel="stylesheet" type="text/css">
	</head>

	<body>

		<div class="login-boxtitle">
			<a href="/mall/index"><img alt="logo" src="/mall/images/logobig.png" /></a>
		</div>

		<div class="login-banner">
			<form id="signupForm">
			<div class="login-main">
				<div class="login-banner-bg"><span></span><img src="/mall/images/big.jpg" /></div>
				<div class="login-box">
							<h3 class="title">登录商城</h3>
							<div class="clear"></div>
								<div class="login-form">

							   <div class="user-name">
								    <label for="user"><i class="am-icon-user"></i></label>
								    <input type="text" name="username" value="admin" id="user" placeholder="邮箱/手机/用户名">
							   </div>
                 <div class="user-pass">
								    <label for="password"><i class="am-icon-lock"></i></label>
								    <input type="password" name="password" value="admin" id="password" placeholder="请输入密码">
                 </div>

           </div>
            
            <div class="login-links">
								<a href="#" class="am-fr">忘记密码</a>
								<a href="/mall/reg" class="zcnext am-fr am-btn-default">注册</a>
								<br />
            </div>
								<div class="am-cf">
									<button class="am-btn am-btn-primary am-btn-sm">登录</button>
								</div>
						<div class="partner">		
								<h3>合作账号</h3>
							<div class="am-btn-group">
								<li><a href="#"><i class="am-icon-qq am-icon-sm"></i><span>QQ登录</span></a></li>
								<li><a href="#"><i class="am-icon-weibo am-icon-sm"></i><span>微博登录</span> </a></li>
								<li><a href="#"><i class="am-icon-weixin am-icon-sm"></i><span>微信登录</span> </a></li>
							</div>
						</div>	

				</div>
			</div>
			</form>
		</div>


		<div th:replace="mall/layout/mallFooter"></div>
	</body>
	<!-- 全局js -->
	<script src="/js/jquery.min.js?v=2.1.4"></script>
	<script src="/js/bootstrap.min.js?v=3.3.6"></script>



	<!-- jQuery Validation plugin javascript-->
	<script src="/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="/js/plugins/validate/messages_zh.min.js"></script>
	<script src="/js/plugins/layer/layer.min.js"></script>
	<script type="text/javascript">
        $(document).ready(function() {
            validateRule();
            //$("#signupForm").validate();
        });
        $.validator.setDefaults({
            submitHandler : function() {
                login();
            }
        });

        function login() {
            console.log($('#signupForm').serialize());
            $.ajax({
                type : "POST",
                url : "/mall/login",
                data : $('#signupForm').serialize(),
                success : function(r) {
                    if (r.code == 0) {
                        location.href = '/mall/index';
                    } else {
                        layer.msg(r.msg);
                    }
                }
            });
        }

        function validateRule() {
            $("#signupForm").validate({
                rules : {
                    username : {
                        required : true
                    },
                    password : {
                        required : true
                    }
                },
                messages : {
                    username : {
                        required :  "请输入您的用户名",
                    },
                    password : {
                        required : "请输入您的密码",
                    }
                }
            })
        }
	</script>
</html>